package pl.rzarajczyk.breaktime;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 *
 * @author rafalz
 */
class ApplicationBeanPostProcessor implements BeanPostProcessor {
    private final ApplicationFramework framework = ApplicationFramework.getInstance();

    @Override
    public Object postProcessAfterInitialization(Object o, String string) throws BeansException {
        if (o instanceof ApplicationFrameworkAware) {
            ((ApplicationFrameworkAware) o).setApplicationFramework(framework);
        }
        return o;
    }

    @Override
    public Object postProcessBeforeInitialization(Object o, String string) throws BeansException {
        // nothing
        return o;
    }
    
}
